package com.hubei.controller;


import com.hubei.pojo.User;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;
import org.springframework.web.servlet.mvc.Controller;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.ArrayList;
import java.util.List;

public class TowController implements Controller {

    @Override
    public ModelAndView handleRequest(HttpServletRequest httpServletRequest,
                                      HttpServletResponse httpServletResponse) throws Exception {
        List<User> list = new ArrayList<>();
        list.add(new User(1,"1","1"));
        list.add(new User(2,"2","2"));
        list.add(new User(3,"3","3"));
        ModelAndView mav = new ModelAndView();
        mav.setViewName("/one.jsp");
        mav.addObject("userlist",list);
        return mav;
    }
}
